class SRVetDemolitions extends SRVeterancyTypes
	abstract;

static function int GetPerkProgressInt( ClientPerkRepLink StatOther, out int FinalInt, byte CurLevel, byte ReqNum )
{
	switch( CurLevel )
	{
	case 0:
		FinalInt = 10000;
		break;
	case 1:
		FinalInt = 25000;
		break;
	case 2:
		FinalInt = 100000;
		break;
	case 3:
		FinalInt = 500000;
		break;
	case 4:
		FinalInt = 1500000;
		break;
	case 5:
		FinalInt = 3500000;
		break;
	case 6:
		FinalInt = 5500000;
		break;
	default:
		if (CurLevel<=12)
			FinalInt = 5500000+GetDoubleScaling(CurLevel,500000);
		else
		{
			if (StatOther.RequirementScaling < 1.0)
				FinalInt = ((5500000+GetDoubleScaling(CurLevel,500000))/StatOther.RequirementScaling)*2;
			else
				FinalInt = ((5500000+GetDoubleScaling(CurLevel,500000))*StatOther.RequirementScaling)*2;
		}
	}
	return Min(StatOther.RExplosivesDamageStat,FinalInt);
}
static function float AddExtraAmmoFor(KFPlayerReplicationInfo KFPRI, Class<Ammunition> AmmoType)
{
	if ( AmmoType == class'FragAmmo' )
		// Up to 6 extra Grenades
		return 1.0 + (0.20 * float(KFPRI.ClientVeteranSkillLevel));
	else if ( AmmoType == class'PipeBombAmmo' || AmmoType == class'BombDT_v2.RadioBombAmmo')
		// Up to 6 extra for a total of 8 Remote Explosive Devices
		return 1.0 + (0.5 * float(KFPRI.ClientVeteranSkillLevel));
	else if ( AmmoType == class'M79Ammo' )
	{
		if ( KFPRI.ClientVeteranSkillLevel > 6 )
			return 0.2167f*float(KFPRI.ClientVeteranSkillLevel)-0.3f; // lvl1-6: 24bombs,  lvl-12: 55-bombs
	}
	else if ( AmmoType == class'M32Ammo' || AmmoType == class'EX41.EX41Ammo')
	{
		if ( KFPRI.ClientVeteranSkillLevel > 6 )
			return 0.1435f*float(KFPRI.ClientVeteranSkillLevel)-0.389f; // lvl1-6: 36bombs,  lvl-12: 67-bombs
	}	
	else if ( AmmoType == class'LAWAmmo' )
	{
		if ( KFPRI.ClientVeteranSkillLevel > 0 )
		{
			if ( KFPRI.ClientVeteranSkillLevel == 1 )
				return 1.10;
			else if ( KFPRI.ClientVeteranSkillLevel == 2 )
				return 1.20;
			else if ( KFPRI.ClientVeteranSkillLevel >= 6 )
				return 1.30; // Level 6 - 30% increase
			return 1.25; // 25% increase
		}
	}
	return 1.0;
}

static function int AddDamage(KFPlayerReplicationInfo KFPRI, KFMonster Injured, KFPawn DamageTaker, int InDamage, class<DamageType> DmgType)
{
	if ( DmgType == class'KFMod.DamTypeFrag'
		|| DmgType == class'KFMod.DamTypePipeBomb'
		|| DmgType == class'BombDT_v2.DamTypeRadioBomb'
		|| DmgType == class'KFMod.DamTypeM79Grenade'
		|| DmgType == class'KFMod.DamTypeM32Grenade'
		|| DmgType == class'KFMod.DamTypeLaw'
		|| DmgType == class'KFMod.DamTypeRocketImpact'
		|| DmgType == class'UnitedMut_v54.DamTypeLAWEx'
		|| DmgType == class'UnitedMut_v54.DamTypeRocketImpactEx'
		|| DmgType == class'KFMod.DamTypeM203Grenade')
	{
		if ( KFPRI.ClientVeteranSkillLevel == 0 )
			return float(InDamage) * 1.05;
		return float(InDamage) * (1.0 + (0.10 * float(KFPRI.ClientVeteranSkillLevel))); //  Up to 60% extra damage
	}

	return InDamage;
}

static function int ReduceDamage(KFPlayerReplicationInfo KFPRI, KFPawn Injured, KFMonster DamageTaker, int InDamage, class<DamageType> DmgType)
{
	if ( DmgType == class'KFMod.DamTypeFrag'
		|| DmgType == class'KFMod.DamTypePipeBomb'
		|| DmgType == class'BombDT_v2.DamTypeRadioBomb'
		|| DmgType == class'KFMod.DamTypeM79Grenade'
		|| DmgType == class'KFMod.DamTypeM32Grenade'
		|| DmgType == class'KFMod.DamTypeLaw'
		|| DmgType == class'KFMod.DamTypeRocketImpact'
		|| DmgType == class'UnitedMut_v54.DamTypeLAWEx'
		|| DmgType == class'UnitedMut_v54.DamTypeRocketImpactEx'
		|| DmgType == class'KFMod.DamTypeM203Grenade')
	{
		return float(InDamage) * FMax(0.75 - (0.05 * float(KFPRI.ClientVeteranSkillLevel)),0.f);
	}
	return InDamage;
}

// Change the cost of particular items
static function float GetCostScaling(KFPlayerReplicationInfo KFPRI, class<Pickup> Item)
{
	if ( Item == class'UnitedMut_v54.WTFEquipPipeBombPickup' )
		return FMax(0.25 - (0.03 * float(KFPRI.ClientVeteranSkillLevel)),0.01f); // Up to 93% discount on PipeBomb
	else if ( Item == class'KFMod.PipeBombPickup' || Item == class'BombDT_v2.RadioBombPickup' )
		// Todo, this won't need to be so extreme when we set up the system to only allow him to buy it perhaps
		return FMax(0.25 - (0.03 * float(KFPRI.ClientVeteranSkillLevel)),0.01f); // Up to 93% discount on PipeBomb
	else if(Item == class'KFMod.M79Pickup'
			|| Item == class'KFMod.M32Pickup'
			|| Item == class'KFMod.LawPickup'
			|| Item == class'UnitedMut_v54.WTFEquipM79CFPickup'
			|| Item == class'UnitedMut_v54.WTFEquipUM32Pickup'
			|| Item == class'EX41.EX41Pickup'
			|| Item == class'M4203Pickup')
		{
			return FMax(0.90 - (0.10 * float(KFPRI.ClientVeteranSkillLevel)),0.1f); // Up to 70% discount on M79/M32
		}
	return 1.0;
}

// Change the cost of particular ammo
static function float GetAmmoCostScaling(KFPlayerReplicationInfo KFPRI, class<Pickup> Item)
{
	if ( Item == class'UnitedMut_v54.WTFEquipPipeBombPickup' )
		return FMax(0.25 - (0.03 * float(KFPRI.ClientVeteranSkillLevel)),0.01f); // Up to 93% discount on PipeBomb
	else if ( Item == class'KFMod.PipeBombPickup' || Item == class'BombDT_v2.RadioBombPickup' )
		// Todo, this won't need to be so extreme when we set up the system to only allow him to buy it perhaps
		return FMax(0.25 - (0.03 * float(KFPRI.ClientVeteranSkillLevel)),0.01f); // Up to 93% discount on PipeBomb
	else if(Item == class'M79Pickup'
			|| Item == class'M32Pickup'
			|| Item == class'LAWPickup'
			|| Item == class'EX41.EX41Pickup'
			|| Item == class'LAWPickupEx'
			|| Item == class'M4203Pickup' )
	{
		return 1.0 - (0.05 * float(KFPRI.ClientVeteranSkillLevel)); // Up to 30% discount on Grenade Launcher and LAW Ammo(Balance Round 5)
	}
	return 1.0;
}

// Give Extra Items as default
static function AddDefaultInventory(KFPlayerReplicationInfo KFPRI, Pawn P)
{
	if ( KFPRI.ClientVeteranSkillLevel >= 5 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.PipeBombExplosive", GetCostScaling(KFPRI, class'KFMod.PipeBombPickup'));
	if ( KFPRI.ClientVeteranSkillLevel >= 6 )
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.M79GrenadeLauncher", GetCostScaling(KFPRI, class'KFMod.M79Pickup'));
	if ( KFPRI.ClientVeteranSkillLevel >= 12 )
	{
		KFHumanPawn(P).CreateInventoryVeterancy("KFMod.M32GrenadeLauncher", GetCostScaling(KFPRI, class'KFMod.M32Pickup'));
		KFHumanPawn(P).CreateInventoryVeterancy("BombDT_v2.RadioBombExplosive", GetCostScaling(KFPRI, class'BombDT_v2.RadioBombPickup'));
//		KFHumanPawn(P).CreateInventoryVeterancy("UnitedMut_v54.WTFEquipUM32a", GetCostScaling(KFPRI, class'UnitedMut_v54.WTFEquipUM32Pickup'));		
	}
}

static function string GetCustomLevelInfo( byte Level )
{
	local string S;

	S = Default.CustomLevelInfo;
	ReplaceText(S,"%s",GetPercentStr(0.1 * float(Level)));
	ReplaceText(S,"%r",GetPercentStr(FMin(0.25f+0.05*float(Level),1.f)));
	ReplaceText(S,"%d",GetPercentStr(0.75+FMin(0.03 * float(Level),0.24f)));
	ReplaceText(S,"%x",string(2+Level));
	ReplaceText(S,"%y",GetPercentStr(0.1+FMin(0.1 * float(Level),0.8f)));
	return S;
}

defaultproperties
{
     CustomLevelInfo="%s extra Explosives damage|%r resistance to Explosives|120% increase in grenade capacity|Can carry %x Remote Explosives|%y discount on Explosives|%d off Remote Explosives|Spawn with an M79 and Pipe Bomb"
     SRLevelEffects(0)="5% extra Explosives damage|25% resistance to Explosives|10% discount on Explosives|75% off Remote Explosives"
     SRLevelEffects(1)="10% extra Explosives damage|30% resistance to Explosives|20% increase in grenade capacity|Can carry 3 Remote Explosives|20% discount on Explosives|78% off Remote Explosives"
     SRLevelEffects(2)="20% extra Explosives damage|35% resistance to Explosives|40% increase in grenade capacity|Can carry 4 Remote Explosives|30% discount on Explosives|81% off Remote Explosives"
     SRLevelEffects(3)="30% extra Explosives damage|40% resistance to Explosives|60% increase in grenade capacity|Can carry 5 Remote Explosives|40% discount on Explosives|84% off Remote Explosives"
     SRLevelEffects(4)="40% extra Explosives damage|45% resistance to Explosives|80% increase in grenade capacity|Can carry 6 Remote Explosives|50% discount on Explosives|87% off Remote Explosives"
     SRLevelEffects(5)="50% extra Explosives damage|50% resistance to Explosives|100% increase in grenade capacity|Can carry 7 Remote Explosives|60% discount on Explosives|90% off Remote Explosives|Spawn with a Pipe Bomb"
     SRLevelEffects(6)="60% extra Explosives damage|55% resistance to Explosives|120% increase in grenade capacity|Can carry 8 Remote Explosives|70% discount on Explosives|93% off Remote Explosives|Spawn with an M79 and Pipe Bomb"
     PerkIndex=6
     OnHUDIcon=Texture'KillingFloor2HUD.Perk_Icons.Perk_Demolition'
     OnHUDGoldIcon=Texture'KillingFloor2HUD.Perk_Icons.Perk_Demolition_Gold'
	 OnHudIconOutline=Texture'Perks_T.Perk_Demolition_Outline'
     VeterancyName="Demolitions"
     Requirements(0)="Deal %x damage with the Explosives"
}
